package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.Map;

@Mapper
public interface UserMapper {

    @Select("select * from sky_take_out.user where openid = #{openId}")
    User getUserByOpenId(String openId);

    void register(User user);

    /**
     * 统计用户数量
     *
     * @param map 查询条件
     * @return
     */
    Integer getUserCount(Map<String, Object> map);

    /**
     * 统计新增用户数量(参数为时间)
     * @param beginTime
     * @param endTime
     * @return
     */
    Integer getUserCountForTime(@Param("beginTime") LocalDateTime beginTime, @Param("endTime") LocalDateTime endTime);
}
